<style>
    .fieldlist dd ins:nth-child(1){width:200px;}
    .fieldlist dd ins:nth-child(2){width:100px;}
    .fieldlist dd ins:nth-child(3){width:100px;}
    .fieldlist dd ins:nth-child(4){width:100px;}
    .fieldlist dd ins:nth-child(5){width:100px;}
    .fieldlist dd input:first-child {width:0;}
    .bonuslist{color: #999;}
    .bonuslist dd{border-bottom: 1px solid #EEE;}
</style>

<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    {if $auth->city_id == 0}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">城市:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-city_id" data-rule="required" data-source="general/lihua_city/index" data-order-by="weigh desc" class="form-control selectpage" name="row[city_id]" type="text" value="{$row.city_id|htmlentities}">
        </div>
    </div>
    {/if}

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>


    <div class="form-group">
        <label for="c-images3" class="control-label col-xs-12 col-sm-2">成功后展示图片:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images3" data-rule="required" class="form-control" size="50" name="row[pic_success]" type="text" readonly value="{$row.pic_success|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span>
                        <button 
                            type="button" id="plupload-images3" 
                            class="btn btn-danger plupload" data-input-id="c-images3" 
                            data-mimetype="image/gif,image/jpeg,image/png,image/jpg" 
                            data-url="xajax/uppic/group/original" 
                            data-maxsize="10M" 
                            data-multiple="false" 
                            data-preview-id="p-images3" 
                            >
                            <i class="fa fa-upload"></i> 上传</button>
                    </span>
                </div>
                <span class="msg-box n-right" for="c-pic_pop"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-images3"></ul>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">红包类型:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                <label for="row[bonus_type]-0"><input id="row[bonus_type]-0" name="row[bonus_type]" type="radio" value="0" {in name="row.bonus_type" value="0"}checked {/in} /> 指定红包</label>
                <label for="row[bonus_type]-1"><input id="row[bonus_type]-1" name="row[bonus_type]" type="radio" value="1" {in name="row.bonus_type" value="1"}checked {/in} /> 随机红包</label>
            </div>
        </div>
    </div>

    <div class="form-group row bonus_type_s bonus_type_1">
        <label class="control-label col-xs-12 col-sm-2">指定红包:</label>
        <div class="col-xs-12 col-sm-8">
            <dl class="fieldlist" data-template="configTpl1" data-name="row[bonus_config_1]">
                <dd><ins>选择红包</ins><ins>红包个数</ins></dd>
                <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></dd>
                <textarea name="row[bonus_config_1]" class="form-control hidden" cols="30" rows="5">{$row.bonus_config_1}</textarea>
            </dl>
            <script id="configTpl1" type="text/html">
                <dd class="form-inline">
                    <ins><input style="width:180px;" type="number" name="<%=name%>[<%=index%>][bonus_id]" class="form-control" value="<%=row.bonus_id%>" placeholder="请输入红包ID" size="10"/></ins>
                    <ins><input style="width:80px;" type="number" name="<%=name%>[<%=index%>][num]" class="form-control" value="<%=row.num%>" placeholder="红包个数"/></ins>
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                    <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                </dd>
            </script>
        </div>
    </div>

    <div class="form-group row bonus_type_s bonus_type_2">
        <label class="control-label col-xs-12 col-sm-2">随机配置:</label>
        <div class="col-xs-12 col-sm-8">
            <dl class="fieldlist" data-template="configTpl2" data-name="row[bonus_config_2]">
                <dd><ins style="width: 280px;">输入随机金额(用英文的,号隔开)</ins><ins>随机个数</ins></dd>
                <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append hidden"><i class="fa fa-plus"></i> 追加</a></dd>
                <textarea name="row[bonus_config_2]" class="form-control hidden" cols="30" rows="5">{$row.bonus_config_2}</textarea>
            </dl>
            <script id="configTpl2" type="text/html">
                <dd class="form-inline" style="display: flex; align-items: flex-start;">
                    <ins style="width: 280px;"><textarea type="number" name="<%=name%>[<%=index%>][bonus_arr]" class="form-control" placeholder="请输入红包随机参数" style="width: 260px;height: 80px;"><%=row.bonus_arr%></textarea></ins>
                    <ins><input style="width: 80px;" type="number" name="<%=name%>[<%=index%>][num]" class="form-control" value="<%=row.num%>" placeholder="红包个数"/></ins>
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                    <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                </dd>
            </script>
        </div>
    </div>

    <div class="form-group row bonuslist">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <dl class="fieldlist" data-template="configTpl">
                <dd>
                    <ins style="width:10%">红包ID</ins>
                    <ins style="width:20%">类型</ins>
                    <ins style="width:20%">红包名称</ins>
                    <ins style="width:20%">指定商品ID</ins>
                    <ins style="width:10%">满多少</ins>
                    <ins style="width:10%">金额</ins>
                </dd>
                {foreach name="bonuslist" item="v"}
                <dd>
                    <ins style="width:10%">{$v['id']}</ins>
                    <ins style="width:20%">{$v['type_name']}</ins>
                    <ins style="width:20%">{$v['name']}</ins>                    
                    <ins style="width:20%">{$v['goods']}</ins>
                    <ins style="width:10%">{$v['reach']}</ins>
                    <ins style="width:10%">{$v['reduce']}</ins>
                </dd>
                {/foreach}
            </dl>
        </div>
    </div>
    
    

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Starttime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-starttime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[starttime]" type="text" value="{$row.starttime_text|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Endtime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-endtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[endtime]" type="text" value="{$row.endtime_text|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">是否启用:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                <label for="row[status]-0"><input id="row[status]-0" name="row[status]" type="radio" value="0" {in name="row.status" value="0"}checked {/in} /> 禁用</label>
                <label for="row[status]-1"><input id="row[status]-1" name="row[status]" type="radio" value="1" {in name="row.status" value="1"}checked {/in} /> 启用</label>

            </div>
        </div>
    </div>

    <div class="form-group layer-footer">
        <div class="text-center">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">关闭</button>
        </div>
    </div>

</form>

